package com.ruoyi.business.service.impl;

import java.util.*;
import java.util.stream.Collectors;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.TrainSeatMapper;
import com.ruoyi.business.domain.TrainSeat;
import com.ruoyi.business.service.ITrainSeatService;

/**
 * 火车座位Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-06
 */
@Service
public class TrainSeatServiceImpl implements ITrainSeatService 
{
    @Autowired
    private TrainSeatMapper trainSeatMapper;

    /**
     * 查询火车座位
     * 
     * @param id 火车座位主键
     * @return 火车座位
     */
    @Override
    public TrainSeat selectTrainSeatById(Long id)
    {
        return trainSeatMapper.selectTrainSeatById(id);
    }

    /**
     * 查询火车座位列表
     * 
     * @param trainSeat 火车座位
     * @return 火车座位
     */
    @Override
    public List<TrainSeat> selectTrainSeatList(TrainSeat trainSeat)
    {
        return trainSeatMapper.selectTrainSeatList(trainSeat);
    }

    /**
     * 新增火车座位
     * 
     * @param trainSeat 火车座位
     * @return 结果
     */
    @Override
    public int insertTrainSeat(TrainSeat trainSeat)
    {
        trainSeat.setCreateTime(DateUtils.getNowDate());
        return trainSeatMapper.insertTrainSeat(trainSeat);
    }

    /**
     * 修改火车座位
     * 
     * @param trainSeat 火车座位
     * @return 结果
     */
    @Override
    public int updateTrainSeat(TrainSeat trainSeat)
    {
        trainSeat.setUpdateTime(DateUtils.getNowDate());
        return trainSeatMapper.updateTrainSeat(trainSeat);
    }

    /**
     * 批量删除火车座位
     * 
     * @param ids 需要删除的火车座位主键
     * @return 结果
     */
    @Override
    public int deleteTrainSeatByIds(Long[] ids)
    {
        return trainSeatMapper.deleteTrainSeatByIds(ids);
    }

    /**
     * 删除火车座位信息
     * 
     * @param id 火车座位主键
     * @return 结果
     */
    @Override
    public int deleteTrainSeatById(Long id)
    {
        return trainSeatMapper.deleteTrainSeatById(id);
    }

    /**
     * 清空火车座位数据
     * 
     * @return 结果
     */
    @Override
    public int clearTrainSeat()
    {
        return trainSeatMapper.clearTrainSeat();
    }

}
